package cn.buk.tms.entity.base;

import cn.buk.tms.entity.misc.Customer;
import cn.buk.tms.entity.misc.PaymentMethod;
import cn.buk.tms.entity.misc.Supplier;

import jakarta.persistence.Column;
import jakarta.persistence.JoinColumn;
import jakarta.persistence.ManyToOne;
import jakarta.persistence.MappedSuperclass;

/**
 * 基础订单信息（订单实体类的通用部分）
 * @author yfdai
 */
@MappedSuperclass
public abstract class BaseOrderInfo extends BaseInfo {


  /**
   * 客户类型
   * 0 - 代表散客
   * 1 - 代表企业客户
   */
  @Column(name = "customer_type")
  private Integer customerType;

  /**
   * 客户在系统中的id: 在t102中对应的ID
   */
  @ManyToOne
  @JoinColumn(name = "customer_id")
  private Customer customer;

  @Column(name = "customer_id", insertable = false, updatable = false)
  private Integer customerId;

  /**
   * 成本中心
   */
  @Column(name = "cost_center", length = 50)
  private String costCenter;

  /**
   * 项目名称
   */
  @Column(name = "project_name", length = 50)
  private String projectName;

  /**
   * 供应商
   */
  @ManyToOne
  @JoinColumn(name = "supplier_id")
  private Supplier supplier;

  /**
   * 支付方式
   */
  @ManyToOne
  @JoinColumn(name = "payment_method_id")
  private PaymentMethod paymentMethod;

  /**
   * 该账单客户的付款方式
   * 1-现金；
   * 2-信用卡；
   * 4-支票；
   * 8-记账
   */
  @Column(name = "pay_type")
  private Integer payType;

  /**
   * 付款备注
   */
  @Column(name = "pay_remark")
  private String payRemark;


  /**
   * 创建此账单的用户名
   */
  @Column(length = 32)
  private String operator;

  /**
   * 出票员
   * ticket drawer
   */
  @Column(length = 32)
  private String ticketer;

  /**
   * 收款员（如果是月结订单，该值为空)
   */
  @Column(length = 32)
  private String cashier;




  public int getCustomerType() {
    return customerType == null ? 1 : customerType;
  }

  public void setCustomerType(Integer customerType) {
    this.customerType = customerType;
  }

  public Customer getCustomer() {
    return customer;
  }

  public void setCustomer(Customer customer) {
    this.customer = customer;
  }

  public int getCustomerId() {
    return customerId == null ? 0 : customerId;
  }

  public void setCustomerId(Integer customerId) {
    this.customerId = customerId;
  }


  public String getCostCenter() {
    return costCenter;
  }

  public void setCostCenter(String costCenter) {
    this.costCenter = costCenter;
  }

  public String getProjectName() {
    return projectName == null ? "" : projectName.trim();
  }

  public void setProjectName(String projectName) {
    this.projectName = projectName;
  }

  public Supplier getSupplier() {
    return supplier;
  }

  public void setSupplier(Supplier supplier) {
    this.supplier = supplier;
  }

  public PaymentMethod getPaymentMethod() {
    return paymentMethod;
  }

  public void setPaymentMethod(PaymentMethod paymentMethod) {
    this.paymentMethod = paymentMethod;
  }

  public int getPayType() {
    return payType == null ? 8 : payType;
  }

  public void setPayType(Integer payType) {
    this.payType = payType;
  }

  public String getPayRemark() {
    return payRemark;
  }

  public void setPayRemark(String payRemark) {
    this.payRemark = payRemark;
  }


  public String getOperator() {
    return operator;
  }

  public void setOperator(String operator) {
    this.operator = operator;
  }

  public String getTicketer() {
    return ticketer;
  }

  public void setTicketer(String ticketer) {
    this.ticketer = ticketer;
  }

  public String getCashier() {
    return cashier;
  }

  public void setCashier(String cashier) {
    this.cashier = cashier;
  }

}
